The Trapword XFCN takes a trap name as a parameter and returns its Trap Word as a result. For example,
put trapword(getnextevent)
will put the value A970 (the trap word of GetNextEvent) into the message box. Note that the trap name should not begin with an underscore character. Also, the case of the characters in the trap name are not significant.
Try the demo below for more details. Also see how this is used in the main disassembly card for another example.